package com.shenglue.ssi.service;

import java.util.List;

import com.shenglue.ssi.dao.BuyInSettleDao;
import com.shenglue.ssi.dao.BuyInMainDao;
import com.shenglue.ssi.domain.BuyInSettle;

public class BuyInSettleServiceImpl implements BuyInSettleService {

	private BuyInSettleDao buyInSettleDao;

	public BuyInSettleDao getBuyInSettleDao() {
		return buyInSettleDao;
	}

	public void setBuyInSettleDao(BuyInSettleDao buyInSettleDao) {
		this.buyInSettleDao = buyInSettleDao;
	}

	/**
	 * 查询某入库单的 所有入库结账单信息
	 */
	public List<BuyInSettle> selectAllBuyInSettle( int buyInId ) {
		return buyInSettleDao.selectAllBuyInSettle( buyInId );
	}

	/**
	 * 增加入库结账单记录
	 */
	public boolean saveBuyInSettle( BuyInSettle buyInSettle ) {
		return buyInSettleDao.saveBuyInSettle( buyInSettle );
	}
	/**
	 * 删除入库结账单记录
	 */
	public boolean deleteBuyInSettle( int buyInSettleId ) {
		return buyInSettleDao.deleteBuyInSettle( buyInSettleId );
	}
	/**
	 * 修改入库结账单记录
	 */
	public boolean updateBuyInSettle( BuyInSettle buyInSettle ) {
		return buyInSettleDao.updateBuyInSettle( buyInSettle );
	}

	/**
	 * 为修改，根据 Id 查一条 入库结账单记录
	 */
	public BuyInSettle getOneBuyInSettleForUpdate( int buyInSettleId ) {
		return buyInSettleDao.getOneBuyInSettleForUpdate( buyInSettleId );
	}
	
	/**
	 * 为计算结清情况，根据 buyInMainId 查一条 入库单主表 需要结账的额度（订单的总额）
	 */
	public float getOneBuyInMainNeedSettle( int buyInMainId ) {
		return buyInSettleDao.getOneBuyInMainNeedSettle( buyInMainId );
	}
	/**
	 * 为计算结清情况，根据 buyInMainId 查一条 入库单主表 已经结账的额度（结账单的总额）
	 */
	public float getOneBuyInMainHasSettle( int buyInMainId ) {
		return buyInSettleDao.getOneBuyInMainHasSettle( buyInMainId );
	}
}
